package com.city.repository.city;

import com.city.domain.city.CityVillage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @deprecation: 村基本信息表
 * @dmail: 398521613@qq.com
 * @author: L-H
 * @date: 2018-07-18 13:14
 */
@Repository
public interface CityVillageRepository extends JpaRepository<CityVillage,Integer> {
    @Query(value = "select * from city_village where town_id = ?1", nativeQuery = true)
    List<CityVillage> findAllByTownId(Integer townId);

    /**
     * @Author: 李顺时
     * @Description: 根据镇乡Id信息获取获取乡镇名称
     * @param id 村的id
     * @Date: 16:55 2018/8/12
     */
    @Query(value = "select village_name from city_village where village_id = ?1", nativeQuery = true)
    String findVillageNameById(Integer id);

}
